TARGETS = perftest perf_memory
all: $(TARGETS) 


CPPFLAGS = -std=c++11
LIBS = -lpthread

DEFS = 
ifdef Release
CPPFLAGS += -O2
endif

ifdef USE_ATOMIC
DEFS = -DUSE_ATOMIC
else
	ifdef USE_CLANG
	DEFS = -DUSE_ATOMIC
	endif
endif

%.o : %.cpp
	g++ $(DEFS) $(CPPFLAGS) -c $< -o $@

perftest: perf_main.o
	g++ $^ -o perftest $(LIBS)

perf_memory: perf_memory.o
	g++ $^ -o perf_memory $(LIBS)

.PHONY: clean
clean:
	rm -rf $(TARGETS) *.o